home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------------------------
-
- Module name: traversal state list module.
-
- Author: Gareth Williams.
-
- Function: This module contains functions for inquiring information
- from the PHIGS Traversal State List.
-
- Dependencies:
-
- Internal function list: traversestruct, box
-
- External function list: ptk_boundingbox
-
- Hashtables used: none.
-
- Modification history: (Version), (Date), (name), (Description).
-
- 1.0, 4th September 1991, G. Williams, First version.
-
- 2.0, June 1992, G. Williams, Converted to ISO PHIGS C.
-
- ----------------------------------------------------------------------------*/
-
- #include <stdio.h>
- #include <math.h>
- #include <phigs.h>
- #include "ptk.h"
-
- /*--------------------------------------------------------------------------*/
-
- #ifdef SUN
- typedef struct ptkstslplus
- {
- /* PHIGS PLUS bits */
- Pint datamapindex;
- Pint backintindex;
- Pint backdatamapindex;
- Pint reflindex;
- Pint backreflindex;
- Pint paramsurfindex;
- Pgcolr linecolour;
- Pint lineshadmeth;
- Pasf linecolourasf;
- Pasf lineshadmethasf;
- Pgcolr markercolour;
- Pasf markercolourasf;
- Pgcolr textcolour;
- Pasf textcolourasf;
- Pdisting_mode distingmode;
- Pcull_mode cullmode;
- Pgcolr intcolour;
- Pint intshadmeth;
- Pint datamapmeth;
- Prefl_props reflprops;
- Pint reflmodel;
- Pasf intcolourasf;
- Pasf intshadmethasf;
- Pasf datamapmethasf;
- Pasf reflpropsasf;
- Pasf reflmodelasf;
- Pint_style backintstyle;
- Pint backintstyleindex;
- Pgcolr backintcolour;
- Pint backintshadmeth;
- Pint backdatamapmeth;
- Prefl_props backreflprops;
- Pint backreflmodel;
- Pasf backintstyleasf;
- Pasf backintstyleindexasf;
- Pasf backintcolourasf;
- Pasf backintshadmethasf;
- Pasf backdatamapmethasf;
- Pasf backreflpropsasf;
- Pasf backreflmodelasf;
- Pint_list lightsrcstate;
- Pint lights[100];
- Pgcolr edgecolour;
- Pasf edgecolourasf;
- Pint curveapproxtype;
- Pfloat curveapproxval;
- Pasf curveapproxasf;
- Pint surfapproxtype;
- Pfloat surfapproxuval;
- Pfloat surfapproxvval;
- Pasf surfapproxval;
- Pint parasurftype;
- Ppara_surf_characs parasurfdata;
- Pasf parasurfasf;
- Pint renderingmodel;
- Pint dcueindex;
- Pint colourmapindex;
- } ptkstslplus;
- #endif
-
- typedef struct ptkstsl
- {
- Pline_attrs lnattr;
- Pmarker_attrs mkattr;
- Pint_attrs interattr;
- Pedge_attrs edgeattr;
- Ptext_bundle txbundl;
- Pint textindex;
- Pasf textfontasf;
- Pasf textprecasf;
- Pasf charexpanasf;
- Pasf charspaceasf;
- Pasf textcolourasf;
- Pfloat charheight;
- Ppoint charup;
- Ptext_path textpath;
- Ptext_align textalign;
- Pfloat annocharheight;
- Ppoint annocharup;
- Ptext_path annotextpath;
- Ptext_align annotextalign;
- Pint annostyle;
- Pfloat_size patsize;
- Ppoint3 patrefpt;
- Ppoint3 patvec[2];
- Pint pickid;
- Pint viewindex;
- Pint hlhsrid;
- Pint_list nameset;
- Pint names[100];
- Pmatrix3 globaltran;
- Pmatrix3 localtran;
- Pint modelclipoperator;
- Phalf_space_list3 modelclipvolume;
- Pclip_ind modelclipindicator;
- #ifdef SUN
- ptkstslplus tslplus;
- #endif
- } ptkstsl;
-
- typedef struct ptkstslstack
- {
- ptkstsl tsl;
- struct ptkstslstack *next;
- } ptkstslstack;
-
- typedef struct ptkstslpos
- {
- Pint stid;
- Pint elemid;
- struct ptkstslpos *next;
- } ptkstslpos;
-
- typedef struct ptkstslbox
- {
- Plimit3 box;
- struct ptkstslbox *next;
- } ptkstslbox;
-
- static ptkstslstack *tslstack = NULL;
- static ptkstslpos *tslpos = NULL;
- static ptkstslbox *tslbox = NULL;
- static ptkstsl tsl;
- static Plimit3 boundbox;
- static Pint curstid, curelemid;
- static Pint firststid, firstelemid;
- #ifdef HP
- static Pstore hpstore;
- static ptkboolean hpstorecreated = FALSE;
- #endif
-
- /*--------------------------------------------------------------------------*/
-
- static void stackpos()
- /*
- ** \blurb{Saves the name and status of the currently open structure,
- ** so it can be restored again by 'unstackstruct'.}
- */
- {
- ptkstslpos *positem;
-
- positem = (ptkstslpos *)malloc(sizeof(ptkstslpos));
- positem->next = tslpos;
- tslpos = positem;
- positem->stid = curstid;
- positem->elemid = curelemid;
- } /* stackpos */
-
- /*--------------------------------------------------------------------------*/
-
- static void unstackpos()
- /*
- ** \blurb{Remove the structure from the top of the stack and
- ** restore the open structure and element pointer.}
- */
- {
- ptkstslpos *positem;
-
- if (tslpos != NULL)
- {
- curstid = tslpos->stid;
- curelemid = tslpos->elemid;
- positem = tslpos->next;
- free(tslpos);
- tslpos = positem;
- }
- } /* unstackpos */
-
- /*--------------------------------------------------------------------------*/
-
- static void testpoint(C(Ppoint3 *) p, C(Plimit3 *) box)
- PreANSI(Ppoint3 *p)
- PreANSI(Plimit3 *box)
- /*
- ** \param{Ppoint3 *}{p}{point.}
- ** \param{Plimit3 *}{boxptr}{bounding box structure}
- ** \blurb{Tests if point `p' is outside bounding box and
- ** if so adjusts bounding box to include it.}
- */
- {
- if (p->x < box->x_min)
- box->x_min = p->x;
- if (p->y < box->y_min)
- box->y_min = p->y;
- if (p->z < box->z_min)
- box->z_min = p->z;
- if (p->x > box->x_max)
- box->x_max = p->x;
- if (p->y > box->y_max)
- box->y_max = p->y;
- if (p->z > box->z_max)
- box->z_max = p->z;
-
- }
-
- /*--------------------------------------------------------------------------*/
-
- static void addnameset(C(Pint_list *) addnames, C(Pint_list *) nameset)
- PreANSI(Pint_list *addnames)
- PreANSI(Pint_list *nameset)
- {
- Pint i;
-
- for (i = 0; i < addnames->num_ints; i++)
- {
- if (inintlst(addnames->ints[i], nameset) == -1)
- {
- nameset->ints[nameset->num_ints] = addnames->ints[i];
- nameset->num_ints++;
- }
- }
- } /* addnameset */
-
- /*--------------------------------------------------------------------------*/
-
- static void removenameset(C(Pint_list *) removenames, C(Pint_list *) nameset)
- PreANSI(Pint_list *removenames)
- PreANSI(Pint_list *nameset)
- {
- Pint i, j, findex;
-
- for (i = 0; i < removenames->num_ints; i++)
- {
- if ((findex = inintlst(removenames->ints[i], nameset)) != -1)
- {
- for (j = findex; j < nameset->num_ints - 1; j++)
- {
- nameset->ints[j] = nameset->ints[j + 1];
- }
- nameset->num_ints--;
- }
- }
- } /* removenameset */
-
- /*--------------------------------------------------------------------------*/
-
- static ptkboolean tsltraverseelement(C(Pint *) execid, C(Plimit3 *) bbox)
- PreANSI(Pint *execid)
- PreANSI(Plimit3 *bbox)
- {
- Pint i, j, k, error;
- Pmatrix3 compxform;
- Pstore store;
- ptkselcontent elcont;
- ptkboolean result;
- Paspect attrid;
- Pasf asf;
- Ppoint3 pt;
-
- result = FALSE;
- *execid = 0;
-
- /* find out type and contents of element */
- #ifndef HP
- pcreate_store(&error, &store);
- ptk_inqcurelemtypesizecontent(store, &error, &elcont);
- #else
- if (!hpstorecreated)
- {
- pcreate_store(&error, &hpstore);
- hpstorecreated = TRUE;
- }
- ptk_inqcurelemtypesizecontent(hpstore, &error, &elcont);
- #endif
- if (error == 0)
- {
- /* not all cases have been implemented yet */
- switch (elcont.eltype)
- {
-
- case PELEM_POLYLINE3:
- case PELEM_POLYMARKER3:
- case PELEM_FILL_AREA3:
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- for (j = 0; j < elcont.eldata->point_list3.num_points; j++)
- {
- pt = ptk_transform3(compxform,
- &elcont.eldata->point_list3.points[j]);
- testpoint(&pt, bbox);
- }
- break;
-
- case PELEM_POLYLINE:
- case PELEM_POLYMARKER:
- case PELEM_FILL_AREA:
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- for (j = 0; j < elcont.eldata->point_list.num_points; j++)
- {
- pt = ptk_point3(elcont.eldata->point_list.points[j].x,
- elcont.eldata->point_list.points[j].y, 0.0);
- pt = ptk_transform3(compxform, &pt);
- testpoint(&pt, bbox);
- }
- break;
-
- case PELEM_TEXT3: /* do nothing */
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- /* inquire text extent assuming text font 1, stroke precision */
- {
- Pint err;
- char *str;
- Prect rect;
- Ppoint offset;
- Pint wstype;
- Pmatrix3 charupmat, txdirmat, txmat;
- Ppoint3 txpt;
- Pfloat angle;
-
- str = elcont.eldata->text3.char_string;
- #ifndef SUN
- /* do for HP and PEXSI */
- rect.p = ptk_point(0.0, 0.0);
- rect.q = ptk_point(0.0, 0.0);
- #endif
- #ifdef SUN
- wstype = phigs_ws_type_create(phigs_ws_type_x_tool, 0);
- pinq_text_extent(wstype, 1, tsl.txbundl.char_expan,
- tsl.txbundl.char_space,
- tsl.charheight, tsl.textpath, tsl.textalign.hor,
- tsl.textalign.vert, str, &err, &rect, &offset);
- #endif
- /* make 2 matrices, one for character up vector
- ** and one for text position and direction vectors.
- */
- ptk_unitmatrix3(charupmat);
- ptk_unitmatrix3(txdirmat);
-
- /* rotate text extent rectangle about z axis to account for the
- ** character up vector.
- */
- angle = (Pfloat)atan2(tsl.charup.x, tsl.charup.y);
- angle *= -180.0/3.1412;
- ptk_rotate3(angle, PTKEZAXIS, PTYPE_REPLACE, charupmat);
-
- txdirmat[0][0] = elcont.eldata->text3.dir[0].delta_x;
- txdirmat[1][0] = elcont.eldata->text3.dir[0].delta_y;
- txdirmat[2][0] = elcont.eldata->text3.dir[0].delta_z;
- txdirmat[0][1] = elcont.eldata->text3.dir[1].delta_x;
- txdirmat[1][1] = elcont.eldata->text3.dir[1].delta_y;
- txdirmat[2][1] = elcont.eldata->text3.dir[1].delta_z;
- txdirmat[0][3] = elcont.eldata->text3.pos.x;
- txdirmat[1][3] = elcont.eldata->text3.pos.y;
- txdirmat[2][3] = elcont.eldata->text3.pos.z;
-
- ptk_concatenatematrix3(PTYPE_POSTCONCAT, txdirmat, charupmat,
- txmat);
- txpt = ptk_point3(rect.p.x, rect.p.y, 0.0);
- txpt = ptk_transform3(txmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&txpt, bbox);
- txpt = ptk_point3(rect.q.x, rect.q.y, 0.0);
- txpt = ptk_transform3(txmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&pt, bbox);
- txpt = ptk_point3(rect.p.x, rect.q.y, 0.0);
- txpt = ptk_transform3(txmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&pt, bbox);
- txpt = ptk_point3(rect.q.x, rect.p.y, 0.0);
- txpt = ptk_transform3(txmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&pt, bbox);
- }
- break;
-
- case PELEM_TEXT: /* do nothing */
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- /* inquire text extent assuming text font 1, stroke precision */
- {
- Pint err;
- char *str;
- Prect rect;
- Ppoint offset;
- Pint wstype;
- Pmatrix3 charupmat;
- Ppoint3 txpt;
- Pfloat angle;
-
- str = elcont.eldata->text.char_string;
- #ifndef SUN
- /* do for HP and PEXSI */
- rect.p = ptk_point(0.0, 0.0);
- rect.q = ptk_point(0.0, 0.0);
- #endif
- #ifdef SUN
- wstype = phigs_ws_type_create(phigs_ws_type_x_tool, 0);
- pinq_text_extent(wstype, 1, tsl.txbundl.char_expan,
- tsl.txbundl.char_space,
- tsl.charheight, tsl.textpath, tsl.textalign.hor,
- tsl.textalign.vert, str, &err, &rect, &offset);
- #endif
- /* make 1 matrix for character up vector
- ** and text position.
- */
- ptk_unitmatrix3(charupmat);
- angle = (Pfloat)atan2(tsl.charup.x, tsl.charup.y);
- angle *= -180.0/3.1412;
- ptk_rotate3(angle, PTKEZAXIS, PTYPE_REPLACE, charupmat);
-
- charupmat[0][3] = elcont.eldata->text.pos.x;
- charupmat[1][3] = elcont.eldata->text.pos.y;
- charupmat[2][3] = 0.0;
-
- txpt = ptk_point3(rect.p.x, rect.p.y, 0.0);
- txpt = ptk_transform3(charupmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&txpt, bbox);
- txpt = ptk_point3(rect.q.x, rect.q.y, 0.0);
- txpt = ptk_transform3(charupmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&txpt, bbox);
- txpt = ptk_point3(rect.p.x, rect.q.y, 0.0);
- txpt = ptk_transform3(charupmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&txpt, bbox);
- txpt = ptk_point3(rect.q.x, rect.p.y, 0.0);
- txpt = ptk_transform3(charupmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&txpt, bbox);
- }
- break;
-
- case PELEM_ANNO_TEXT_REL3:
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- /* inquire text extent assuming text font 1, stroke precision */
- {
- Pint err;
- char *str;
- Prect rect;
- Ppoint offset;
- Pint wstype;
- Pmatrix3 charupmat;
- Ppoint3 txpt;
- Pfloat angle;
-
- str = elcont.eldata->anno_text_rel3.char_string;
- #ifndef SUN
- /* do for HP and PEXSI */
- rect.p = ptk_point(0.0, 0.0);
- rect.q = ptk_point(0.0, 0.0);
- #endif
- #ifdef SUN
- wstype = phigs_ws_type_create(phigs_ws_type_x_tool, 0);
- pinq_text_extent(wstype, 1, tsl.txbundl.char_expan,
- tsl.txbundl.char_space,
- tsl.annocharheight, tsl.annotextpath,
- tsl.annotextalign.hor, tsl.annotextalign.vert,
- str, &err, &rect, &offset);
- #endif
- /* make 2 matrices, one for character up vector
- ** and text position, and one for direction vectors.
- */
- ptk_unitmatrix3(charupmat);
- angle = (Pfloat)atan2(tsl.charup.x, tsl.charup.y);
- angle *= -180.0/3.1412;
- ptk_rotate3(angle, PTKEZAXIS, PTYPE_REPLACE, charupmat);
-
- /* lead line - annotation style, include ref_pt */
- charupmat[0][3] = elcont.eldata->anno_text_rel3.ref_point.x +
- elcont.eldata->anno_text_rel3.offset.delta_x;
- charupmat[1][3] = elcont.eldata->anno_text_rel3.ref_point.y +
- elcont.eldata->anno_text_rel3.offset.delta_y;
- charupmat[2][3] = elcont.eldata->anno_text_rel3.ref_point.z +
- elcont.eldata->anno_text_rel3.offset.delta_z;
-
- txpt = ptk_point3(rect.p.x, rect.p.y, 0.0);
- txpt = ptk_transform3(charupmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&txpt, bbox);
- txpt = ptk_point3(rect.q.x, rect.q.y, 0.0);
- txpt = ptk_transform3(charupmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&txpt, bbox);
- txpt = ptk_point3(rect.p.x, rect.q.y, 0.0);
- txpt = ptk_transform3(charupmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt),
- testpoint(&txpt, bbox);
- txpt = ptk_point3(rect.q.x, rect.p.y, 0.0);
- txpt = ptk_transform3(charupmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&txpt, bbox);
- }
- break;
-
- case PELEM_ANNO_TEXT_REL: /* do nothing */
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- /* inquire text extent assuming text font 1, stroke precision */
- {
- Pint err;
- char *str;
- Prect rect;
- Ppoint offset;
- Pint wstype;
- Pmatrix3 charupmat;
- Ppoint3 txpt;
- Pfloat angle;
-
- str = elcont.eldata->anno_text_rel.char_string;
- #ifndef SUN
- /* do for HP and PEXSI */
- rect.p = ptk_point(0.0, 0.0);
- rect.q = ptk_point(0.0, 0.0);
- #endif
- #ifdef SUN
- wstype = phigs_ws_type_create(phigs_ws_type_x_tool, 0);
- pinq_text_extent(wstype, 1, tsl.txbundl.char_expan,
- tsl.txbundl.char_space,
- tsl.annocharheight, tsl.annotextpath,
- tsl.annotextalign.hor, tsl.annotextalign.vert,
- str, &err, &rect, &offset);
- #endif
- /* make 2 matrices, one for character up vector
- ** and text position, and one for direction vectors.
- */
- ptk_unitmatrix3(charupmat);
- angle = (Pfloat)atan2(tsl.charup.x, tsl.charup.y);
- angle *= -180.0/3.1412;
- ptk_rotate3(angle, PTKEZAXIS, PTYPE_REPLACE, charupmat);
-
- /* lead line - annotation style, include ref_pt */
- charupmat[0][3] = elcont.eldata->anno_text_rel.ref_point.x +
- elcont.eldata->anno_text_rel.offset.delta_x;
- charupmat[1][3] = elcont.eldata->anno_text_rel.ref_point.y +
- elcont.eldata->anno_text_rel.offset.delta_y;
- charupmat[2][3] = 0.0;
-
- txpt = ptk_point3(rect.p.x, rect.p.y, 0.0);
- txpt = ptk_transform3(charupmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&txpt, bbox);
- txpt = ptk_point3(rect.q.x, rect.q.y, 0.0);
- txpt = ptk_transform3(charupmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&txpt, bbox);
- txpt = ptk_point3(rect.p.x, rect.q.y, 0.0);
- txpt = ptk_transform3(charupmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&txpt, bbox);
- txpt = ptk_point3(rect.q.x, rect.p.y, 0.0);
- txpt = ptk_transform3(charupmat, &txpt);
- txpt = ptk_transform3(compxform, &txpt);
- testpoint(&txpt, bbox);
- }
- break;
-
- case PELEM_FILL_AREA_SET3:
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- for (j = 0; j < elcont.eldata->point_list_list3.num_point_lists; j++)
- {
- for (k = 0; k < elcont.eldata->point_list_list3.point_lists[j].num_points; k++)
- {
- pt = ptk_transform3(compxform,
- &elcont.eldata->point_list_list3.point_lists[j].points[k]),
- testpoint(&pt, bbox);
- }
- }
- break;
-
- case PELEM_FILL_AREA_SET: /* do nothing */
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- {
- Ppoint fpt;
-
- for (j = 0; j < elcont.eldata->point_list_list.num_point_lists; j++)
- {
- for (k = 0; k < elcont.eldata->point_list_list.point_lists[j].num_points; k++)
- {
- fpt = elcont.eldata->point_list_list.point_lists[j].points[k];
- pt = ptk_point3(fpt.x, fpt.y, 0.0);
- pt = ptk_transform3(compxform, &pt);
- testpoint(&pt, bbox);
- }
- }
- }
- break;
-
- case PELEM_CELL_ARRAY3:
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- pt = ptk_transform3(compxform, &elcont.eldata->cell_array3.paral.p);
- testpoint(&pt, bbox);
- pt = ptk_transform3(compxform, &elcont.eldata->cell_array3.paral.q);
- testpoint(&pt, bbox);
- pt = ptk_transform3(compxform, &elcont.eldata->cell_array3.paral.r);
- testpoint(&pt, bbox);
- break;
-
- case PELEM_CELL_ARRAY:
- {
- Ppoint cellpt;
-
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- cellpt = elcont.eldata->cell_array.rect.p;
- pt = ptk_point3(cellpt.x, cellpt.y, 0.0);
- pt = ptk_transform3(compxform, &pt);
- testpoint(&pt, bbox);
- cellpt = elcont.eldata->cell_array.rect.q;
- pt = ptk_point3(cellpt.x, cellpt.y, 0.0);
- pt = ptk_transform3(compxform, &pt);
- testpoint(&pt, bbox);
- }
- break;
-
- case PELEM_CHAR_EXPAN:
- tsl.txbundl.char_expan = elcont.eldata->float_data;
- break;
-
- case PELEM_CHAR_SPACE:
- tsl.txbundl.char_space = elcont.eldata->float_data;
- break;
-
- case PELEM_CHAR_HT:
- tsl.charheight = elcont.eldata->float_data;
- break;
-
- case PELEM_CHAR_UP_VEC:
- tsl.charup = ptk_point(elcont.eldata->char_up_vec.delta_x,
- elcont.eldata->char_up_vec.delta_y);
- break;
-
- case PELEM_TEXT_PATH:
- tsl.textpath = elcont.eldata->text_path;
- break;
-
- case PELEM_TEXT_ALIGN:
- tsl.textalign = elcont.eldata->text_align;
- break;
-
- case PELEM_ANNO_CHAR_HT:
- tsl.charheight = elcont.eldata->float_data;
- break;
-
- case PELEM_ANNO_CHAR_UP_VEC:
- tsl.annocharup = ptk_point(elcont.eldata->char_up_vec.delta_x,
- elcont.eldata->char_up_vec.delta_y);
- break;
-
- case PELEM_ANNO_PATH:
- tsl.annotextpath = elcont.eldata->text_path;
- break;
-
- case PELEM_ANNO_ALIGN:
- tsl.annotextalign = elcont.eldata->text_align;
- break;
-
- case PELEM_LOCAL_MODEL_TRAN3:
- ptk_concatenatematrix3(elcont.eldata->local_tran3.compose_type,
- elcont.eldata->local_tran3.matrix, tsl.localtran, tsl.localtran);
- break;
-
- case PELEM_LOCAL_MODEL_TRAN:
- {
- Pmatrix3 local4x4;
- /* convert 3x3 matrix to 4x4 matrix */
-
- ptk_matrixtomatrix3(elcont.eldata->local_tran.matrix, local4x4);
- ptk_concatenatematrix3(elcont.eldata->local_tran.compose_type,
- local4x4, tsl.localtran, tsl.localtran);
- }
- break;
-
- case PELEM_GLOBAL_MODEL_TRAN3:
- memcpy(tsl.globaltran, elcont.eldata->global_tran3, sizeof(Pmatrix3));
- break;
-
- case PELEM_GLOBAL_MODEL_TRAN:
- {
- Pmatrix3 global4x4;
-
- ptk_matrixtomatrix3(elcont.eldata->global_tran, global4x4);
- memcpy(tsl.globaltran, global4x4, sizeof(Pmatrix3));
- }
- break;
-
- case PELEM_EXEC_STRUCT:
- result = TRUE;
- *execid = elcont.eldata->int_data;
- break;
-
- case PELEM_NIL: /* do nothing */
- break;
-
- case PELEM_LINE_IND:
- tsl.lnattr.ind = elcont.eldata->int_data;
- break;
-
- case PELEM_MARKER_IND:
- tsl.mkattr.ind = elcont.eldata->int_data;
- break;
-
- case PELEM_TEXT_IND:
- tsl.textindex = elcont.eldata->int_data;
- break;
-
- case PELEM_INT_IND:
- tsl.interattr.ind = elcont.eldata->int_data;
- break;
-
- case PELEM_EDGE_IND:
- tsl.edgeattr.ind = elcont.eldata->int_data;
- break;
-
- case PELEM_LINETYPE:
- tsl.lnattr.bundle.type = elcont.eldata->int_data;
- break;
-
- case PELEM_LINEWIDTH:
- tsl.lnattr.bundle.width = elcont.eldata->float_data;
- break;
-
- case PELEM_LINE_COLR_IND:
- tsl.lnattr.bundle.colr_ind = elcont.eldata->int_data;
- break;
-
- case PELEM_MARKER_TYPE:
- tsl.mkattr.bundle.type = elcont.eldata->int_data;
- break;
-
- case PELEM_MARKER_SIZE:
- tsl.mkattr.bundle.size = elcont.eldata->float_data;
- break;
-
- case PELEM_MARKER_COLR_IND:
- tsl.mkattr.bundle.colr_ind = elcont.eldata->int_data;
- break;
-
- case PELEM_TEXT_FONT:
- tsl.txbundl.font = elcont.eldata->int_data;
- break;
-
- case PELEM_TEXT_PREC:
- tsl.txbundl.prec = elcont.eldata->text_prec;
- break;
-
- case PELEM_TEXT_COLR_IND:
- tsl.txbundl.colr_ind = elcont.eldata->int_data;
- break;
-
- case PELEM_ANNO_STYLE:
- tsl.annostyle = elcont.eldata->int_data;
- break;
-
- case PELEM_INT_STYLE:
- tsl.interattr.bundle.style = elcont.eldata->int_style;
- break;
-
- case PELEM_INT_STYLE_IND:
- tsl.interattr.bundle.style_ind = elcont.eldata->int_data;
- break;
-
- case PELEM_INT_COLR_IND:
- tsl.interattr.bundle.colr_ind = elcont.eldata->int_data;
- break;
-
- case PELEM_EDGE_FLAG:
- tsl.edgeattr.bundle.flag = elcont.eldata->edge_flag;
- break;
-
- case PELEM_EDGETYPE:
- tsl.edgeattr.bundle.type = elcont.eldata->int_data;
- break;
-
- case PELEM_EDGEWIDTH:
- tsl.edgeattr.bundle.width = elcont.eldata->float_data;
- break;
-
- case PELEM_EDGE_COLR_IND:
- tsl.edgeattr.bundle.colr_ind = elcont.eldata->int_data;
- break;
-
- case PELEM_PAT_SIZE:
- tsl.patsize = elcont.eldata->pat_size;
- break;
-
- case PELEM_PAT_REF_POINT_VECS:
- tsl.patrefpt = elcont.eldata->pat_ref_point_vecs.ref_point;
- tsl.patvec[0] = ptk_vec3topt3(&elcont.eldata->pat_ref_point_vecs.ref_vec[0]);
- tsl.patvec[1] = ptk_vec3topt3(&elcont.eldata->pat_ref_point_vecs.ref_vec[1]);
- break;
-
- case PELEM_PAT_REF_POINT:
- tsl.patrefpt = ptk_point3(elcont.eldata->pat_ref_point.x,
- elcont.eldata->pat_ref_point.y, 0.0);
- break;
-
- case PELEM_ADD_NAMES_SET:
- addnameset(&elcont.eldata->names, &tsl.nameset);
- break;
-
- case PELEM_REMOVE_NAMES_SET:
- removenameset(&elcont.eldata->names, &tsl.nameset);
- break;
-
- case PELEM_INDIV_ASF:
- attrid = elcont.eldata->asf.id;
- asf = elcont.eldata->asf.source;
- switch (attrid)
- {
- case PASPECT_LINETYPE:
- tsl.lnattr.type_asf = asf;
- break;
-
- case PASPECT_LINEWIDTH:
- tsl.lnattr.width_asf = asf;
- break;
-
- case PASPECT_LINE_COLR_IND:
- tsl.lnattr.colr_ind_asf = asf;
- break;
-
- case PASPECT_MARKER_TYPE:
- tsl.mkattr.type_asf = asf;
- break;
-
- case PASPECT_MARKER_SIZE:
- tsl.mkattr.size_asf = asf;
- break;
-
- case PASPECT_MARKER_COLR_IND:
- tsl.mkattr.colr_ind_asf = asf;
- break;
-
- case PASPECT_TEXT_FONT:
- tsl.textfontasf = asf;
- break;
-
- case PASPECT_TEXT_PREC:
- tsl.textprecasf = asf;
- break;
-
- case PASPECT_CHAR_EXPAN:
- tsl.charexpanasf = asf;
- break;
-
- case PASPECT_CHAR_SPACE:
- tsl.charspaceasf = asf;
- break;
-
- case PASPECT_TEXT_COLR_IND:
- tsl.textcolourasf = asf;
- break;
-
- case PASPECT_INT_STYLE:
- tsl.interattr.style_asf = asf;
- break;
-
- case PASPECT_INT_STYLE_IND:
- tsl.interattr.style_ind_asf = asf;
- break;
-
- case PASPECT_INT_COLR_IND:
- tsl.interattr.colr_ind_asf = asf;
- break;
-
- case PASPECT_EDGE_FLAG:
- tsl.edgeattr.flag_asf = asf;
- break;
-
- case PASPECT_EDGETYPE:
- tsl.edgeattr.type_asf = asf;
- break;
-
- case PASPECT_EDGEWIDTH:
- tsl.edgeattr.width_asf = asf;
- break;
-
- case PASPECT_EDGE_COLR_IND:
- tsl.edgeattr.colr_ind_asf = asf;
- break;
- }
- break;
-
- case PELEM_HLHSR_ID:
- tsl.hlhsrid = elcont.eldata->int_data;
- break;
-
- case PELEM_MODEL_CLIP_VOL3:
- break;
-
- case PELEM_MODEL_CLIP_VOL:
- break;
-
- case PELEM_MODEL_CLIP_IND:
- break;
-
- case PELEM_RESTORE_MODEL_CLIP_VOL:
- break;
-
- case PELEM_VIEW_IND:
- tsl.viewindex = elcont.eldata->int_data;
- break;
-
- case PELEM_GSE:
- break;
-
- case PELEM_PICK_ID:
- tsl.pickid = elcont.eldata->int_data;
- break;
-
- /* PHIGS PLUS bits */
- #ifdef SUN
- case PELEM_POLYLINE_SET3_DATA:
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- for (j = 0; j < elcont.eldata->plsd3.npl; j++)
- {
- for (k = 0; k < elcont.eldata->plsd3.vdata[j].num_vertices; k++)
- {
- switch (elcont.eldata->plsd3.vflag)
- {
- case PVERT_COORD:
- pt = elcont.eldata->plsd3.vdata[j].vertex_data.points[k];
- break;
-
- case PVERT_COORD_COLOUR:
- pt = elcont.eldata->plsd3.vdata[j].vertex_data.ptcolrs[k].point;
- break;
- }
- pt = ptk_transform3(compxform, &pt);
- testpoint(&pt, bbox);
- }
- }
- break;
-
- case PELEM_FILL_AREA_SET3_DATA:
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- for (j = 0; j < elcont.eldata->fasd3.nfa; j++)
- {
- for (k = 0; k < elcont.eldata->fasd3.vdata[j].num_vertices; k++)
- {
- switch (elcont.eldata->fasd3.vflag)
- {
- case PVERT_COORD:
- pt = elcont.eldata->fasd3.vdata[j].vertex_data.points[k];
- break;
-
- case PVERT_COORD_COLOUR:
- pt = elcont.eldata->fasd3.vdata[j].vertex_data.ptcolrs[k].point;
- break;
-
- case PVERT_COORD_NORMAL:
- pt = elcont.eldata->fasd3.vdata[j].vertex_data.ptnorms[k].point;
- break;
-
- case PVERT_COORD_COLOUR_NORMAL:
- pt = elcont.eldata->fasd3.vdata[j].vertex_data.ptconorms[k].point;
- break;
- }
- pt = ptk_transform3(compxform, &pt);
- testpoint(&pt, bbox);
- }
- }
- break;
-
- case PELEM_TRI_STRIP3_DATA:
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- for (j = 0; j < elcont.eldata->tsd3.nv; j++)
- {
- switch (elcont.eldata->tsd3.vflag)
- {
- case PVERT_COORD:
- pt = elcont.eldata->tsd3.vdata.points[j];
- break;
-
- case PVERT_COORD_COLOUR:
- pt = elcont.eldata->tsd3.vdata.ptcolrs[j].point;
- break;
-
- case PVERT_COORD_NORMAL:
- pt = elcont.eldata->tsd3.vdata.ptnorms[j].point;
- break;
-
- case PVERT_COORD_COLOUR_NORMAL:
- pt = elcont.eldata->tsd3.vdata.ptconorms[j].point;
- break;
- }
- pt = ptk_transform3(compxform, &pt);
- testpoint(&pt, bbox);
- }
- break;
-
- case PELEM_QUAD_MESH3_DATA:
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- k = elcont.eldata->qmd3.dim.size_x * elcont.eldata->qmd3.dim.size_y;
- for (j = 0; j < k; j++)
- {
- switch (elcont.eldata->qmd3.vflag)
- {
- case PVERT_COORD:
- pt = elcont.eldata->qmd3.vdata.points[j];
- break;
-
- case PVERT_COORD_COLOUR:
- pt = elcont.eldata->qmd3.vdata.ptcolrs[j].point;
- break;
-
- case PVERT_COORD_NORMAL:
- pt = elcont.eldata->qmd3.vdata.ptnorms[j].point;
- break;
-
- case PVERT_COORD_COLOUR_NORMAL:
- pt = elcont.eldata->qmd3.vdata.ptconorms[j].point;
- break;
- }
- pt = ptk_transform3(compxform, &pt);
- testpoint(&pt, bbox);
- }
- break;
-
- case PELEM_SET_OF_FILL_AREA_SET3_DATA:
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- for (j = 0; j < elcont.eldata->sofas3.vdata.num_vertices; j++)
- {
- switch (elcont.eldata->sofas3.vflag)
- {
- case PVERT_COORD:
- pt = elcont.eldata->sofas3.vdata.vertex_data.points[j];
- break;
-
- case PVERT_COORD_COLOUR:
- pt = elcont.eldata->sofas3.vdata.vertex_data.ptcolrs[j].point;
- break;
-
- case PVERT_COORD_NORMAL:
- pt = elcont.eldata->sofas3.vdata.vertex_data.ptnorms[j].point;
- break;
-
- case PVERT_COORD_COLOUR_NORMAL:
- pt = elcont.eldata->sofas3.vdata.vertex_data.ptconorms[j].point;
- break;
- }
- pt = ptk_transform3(compxform, &pt);
- testpoint(&pt, bbox);
- }
- break;
-
- case PELEM_NUNI_BSP_CURVE:
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- for (j = 0; j < elcont.eldata->nurb_curve.cpts.num_points; j++)
- {
- switch (elcont.eldata->nurb_curve.rationality)
- {
- case PRATIONAL:
- pt = ptk_pt4topt3(&elcont.eldata->nurb_curve.cpts.points.point4d[j]);
- break;
-
- case PNON_RATIONAL:
- pt = elcont.eldata->nurb_curve.cpts.points.point3d[j];
- break;
- }
- pt = ptk_transform3(compxform, &pt);
- testpoint(&pt, bbox);
- }
- break;
-
- case PELEM_NUNI_BSP_SURF:
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- k = elcont.eldata->nurb_surf.grid.num_points.u_dim *
- elcont.eldata->nurb_surf.grid.num_points.v_dim;
- for (j = 0; j < k; j++)
- {
- switch (elcont.eldata->nurb_surf.rationality)
- {
- case PRATIONAL:
- pt = ptk_pt4topt3(&elcont.eldata->nurb_surf.grid.points.point4d[j]);
- break;
-
- case PNON_RATIONAL:
- pt = elcont.eldata->nurb_surf.grid.points.point3d[j];
- break;
- }
- pt = ptk_transform3(compxform, &pt);
- testpoint(&pt, bbox);
- }
- break;
-
- case PELEM_CELL_ARRAY3_PLUS:
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, compxform);
- pt = ptk_transform3(compxform,
- &elcont.eldata->cell_array_plus.paral.p);
- testpoint(&pt, bbox);
- pt = ptk_transform3(compxform,
- &elcont.eldata->cell_array_plus.paral.q);
- testpoint(&pt, bbox);
- pt = ptk_transform3(compxform,
- &elcont.eldata->cell_array_plus.paral.r);
- testpoint(&pt, bbox);
- break;
-
- case PELEM_TEXT_COLR:
- tsl.tslplus.textcolour = elcont.eldata->colr;
- break;
-
- case PELEM_MARKER_COLR:
- tsl.tslplus.markercolour = elcont.eldata->colr;
- break;
-
- case PELEM_EDGE_COLR:
- tsl.tslplus.edgecolour = elcont.eldata->colr;
- break;
-
- case PELEM_LINE_COLR:
- tsl.tslplus.linecolour = elcont.eldata->colr;
- break;
-
- case PELEM_CURVE_APPROX_CRIT:
- tsl.tslplus.curveapproxtype = elcont.eldata->curv_approx.type;
- tsl.tslplus.curveapproxval = elcont.eldata->curv_approx.value;
- break;
-
- case PELEM_LINE_SHAD_METH:
- tsl.tslplus.lineshadmeth = elcont.eldata->int_data;
- break;
-
- case PELEM_INT_COLR:
- tsl.tslplus.intcolour = elcont.eldata->colr;
- break;
-
- case PELEM_BACK_INT_COLR:
- tsl.tslplus.backintcolour = elcont.eldata->colr;
- break;
-
- case PELEM_BACK_INT_STYLE:
- tsl.tslplus.backintstyle = elcont.eldata->int_style;
- break;
-
- case PELEM_BACK_INT_STYLE_IND:
- tsl.tslplus.backintstyleindex = elcont.eldata->int_data;
- break;
-
- case PELEM_REFL_PROPS:
- tsl.tslplus.reflprops = elcont.eldata->props;
- break;
-
- case PELEM_BACK_REFL_PROPS:
- tsl.tslplus.backreflprops = elcont.eldata->props;
- break;
-
- case PELEM_INT_SHAD_METH:
- tsl.tslplus.intshadmeth = elcont.eldata->int_data;
- break;
-
- case PELEM_BACK_INT_SHAD_METH:
- tsl.tslplus.backintshadmeth = elcont.eldata->int_data;
- break;
-
- case PELEM_INT_REFL_EQN:
- tsl.tslplus.reflmodel = elcont.eldata->int_data;
- break;
-
- case PELEM_BACK_INT_REFL_EQN:
- tsl.tslplus.backreflmodel = elcont.eldata->int_data;
- break;
-
- case PELEM_SURF_APPROX_CRIT:
- tsl.tslplus.surfapproxtype = elcont.eldata->surf_approx.type;
- tsl.tslplus.surfapproxuval = elcont.eldata->surf_approx.u_val;
- tsl.tslplus.surfapproxvval = elcont.eldata->surf_approx.v_val;
- break;
-
- case PELEM_PARA_SURF_CHARACS:
- tsl.tslplus.parasurftype = elcont.eldata->para_surf_characs.type;
- tsl.tslplus.parasurfdata = elcont.eldata->para_surf_characs.data;
- break;
-
- case PELEM_FACE_DISTING_MODE:
- tsl.tslplus.distingmode = elcont.eldata->disting_mode;
- break;
-
- case PELEM_FACE_CULL_MODE:
- tsl.tslplus.cullmode = elcont.eldata->cull_mode;
- break;
-
- case PELEM_LIGHT_SRC_STATE:
- addnameset(&elcont.eldata->lss.activation,
- &tsl.tslplus.lightsrcstate);
- removenameset(&elcont.eldata->lss.deactivation,
- &tsl.tslplus.lightsrcstate);
- break;
-
- case PELEM_DCUE_IND:
- tsl.tslplus.dcueindex = elcont.eldata->int_data;
- break;
-
- case PELEM_COLR_MAP_IND:
- tsl.tslplus.colourmapindex = elcont.eldata->int_data;
- break;
-
- case PELEM_RENDERING_COLR_MODEL:
- tsl.tslplus.renderingmodel = elcont.eldata->int_data;
- break;
-
- #endif
- default:
- break;
-
- }/* of case */
- }
- ptk_delstore(store);
- return result;
- } /* tsltraverseelement */
-
- /*--------------------------------------------------------------------------*/
-
- static void tsltraversepath(C(Pint *) sno, C(Pint) structid,
- C(Pelem_ref_list *) reflst)
- PreANSI(Pint *sno)
- PreANSI(Pint structid)
- PreANSI(Pelem_ref_list *reflst)
- /*
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Pint i, numelts, execid, err;
- ptkboolean finished;
-
- finished = FALSE;
- ptk_unitmatrix3(tsl.localtran);
- numelts = ptk_elemcount(structid);
-
- i = 1;
- do
- {
- pset_elem_ptr(i);
- if ((*sno == reflst->num_elem_refs) &&
- (reflst->elem_refs[reflst->num_elem_refs-1].elem_pos == i-1))
- finished = TRUE;
- else
- if (tsltraverseelement(&execid, &boundbox))
- {
- if (((*sno < reflst->num_elem_refs) &&
- (reflst->elem_refs[*sno - 1].elem_pos == i) &&
- (reflst->elem_refs[*sno - 1].struct_id == structid)) ||
- ((*sno >= reflst->num_elem_refs) &&
- (reflst->elem_refs[reflst->num_elem_refs - 1].elem_pos < 0)))
- {
- ptk_stacktsl();
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, tsl.globaltran);
- ptk_openstruct(execid);
- (*sno)++;
- tsltraversepath(sno, execid, reflst);
- ptk_closestruct();
- ptk_unstacktsl();
- pinq_elem_ptr(&err, &i);
- }
- else
- if (i < reflst->elem_refs[*sno - 1].elem_pos)
- {
- ptk_tsltraverserange(execid, 1, execid, -1, TRUE);
- }
- }
- i++;
- } while ((i <= numelts) && (!finished));
- } /* tsltraversepath */
-
- /*--------------------------------------------------------------------------*/
-
- static void tsltraverserange(C(Pint) startstid, C(Pint) startelemid,
- C(Pint) stopstid, C(Pint) stopelemid,
- C(ptkboolean) descend)
- PreANSI(Pint startstid)
- PreANSI(Pint startelemid)
- PreANSI(Pint stopstid)
- PreANSI(Pint stopelemid)
- PreANSI(ptkboolean descend)
- /*
- ** input params:
- ** output params:
- ** return value:
- */
- {
- Pint i, numelts, execid, err;
- ptkboolean finished;
-
- finished = FALSE;
- ptk_unitmatrix3(tsl.localtran);
- numelts = ptk_elemcount(startstid);
-
- i = startelemid;
- do
- {
- pset_elem_ptr(i);
- if ((startstid == stopstid) && (i == stopelemid))
- finished = TRUE;
- if ((tsltraverseelement(&execid, &boundbox)) && (descend))
- {
- ptk_stacktsl();
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, tsl.globaltran);
- ptk_openstruct(execid);
- tsltraverserange(execid, 1, stopstid, stopelemid, descend);
- ptk_closestruct();
- ptk_unstacktsl();
- pinq_elem_ptr(&err, &i);
- }
- i++;
- } while ((i <= numelts) && (!finished));
- } /* tsltraverserange */
-
- /*-------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_stackbbox(C(void))
- /* PreANSI() */
- /*
- ** \blurb{This function puts the current bounding box value on the
- ** TSL bounding box stack.}
- */
- {
- ptkstslbox *boxitem;
-
- boxitem = (ptkstslbox *)malloc(sizeof(ptkstslbox));
- boxitem->next = tslbox;
- tslbox = boxitem;
- boxitem->box = boundbox;
- } /* ptk_stackbbox */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_unstackbbox(C(void))
- /* PreANSI() */
- /*
- ** \blurb{This function gets the topmost bounding box value from the
- ** TSL bounding box stack.}
- */
- {
- ptkstslbox *boxitem;
-
- if (tslbox != NULL)
- {
- boundbox = tslbox->box;
- boxitem = tslbox->next;
- free(tslbox);
- tslbox = boxitem;
- }
- } /* ptk_unstackbbox */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_stacktsl(C(void))
- /* PreANSI() */
- /*
- ** \blurb{This function puts the current TSL value on the TSL stack.}
- */
- {
- ptkstslstack *stackitem;
-
- stackitem = (ptkstslstack *)malloc(sizeof(ptkstslstack));
- stackitem->next = tslstack;
- tslstack = stackitem;
- stackitem->tsl = tsl;
- } /* ptk_stacktsl */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_unstacktsl(C(void))
- /* PreANSI() */
- /*
- ** \blurb{This function gets the topmost TSL value from the TSL stack.}
- */
- {
- ptkstslstack *stackitem;
-
- if (tslstack != NULL)
- {
- tsl = tslstack->tsl;
- stackitem = tslstack->next;
- free(tslstack);
- tslstack = stackitem;
- }
- } /* ptk_unstacktsl */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern ptkboolean ptk_boundingbox(C(Pint) structid, C(Plimit3 *) wcbounds,
- C(ptkboolean) descend)
- PreANSI(Pint structid)
- PreANSI(Plimit3 *wcbounds)
- PreANSI(ptkboolean descend)
- /*
- ** \parambegin
- ** \param{Pint}{structid}{structure network identifier}{IN}
- ** \param{Plimit3 *}{wcbounds}{bounding box in world coordinates}{OUT}
- ** \param{ptkboolean}{descend}{flag to indicate traversal}{IN}
- ** \paramend
- ** \blurb{This function evaluates the bounding box for a structure or
- ** structure network. If {\tt descend}
- ** is set to TRUE then the bounding box for the complete structure
- ** network is returned, otherwise just for a single structure.
- ** The function returns TRUE if the resulting bounding box is valid,
- ** otherwise FALSE. A structure with no output primitives returns an
- ** invalid bounding box.}
- */
- {
- ptk_stacktsl();
- ptk_stackbbox();
- ptk_inittsl();
- ptk_openstruct(structid);
- tsltraverserange(structid, 1, structid, -1, descend);
- *wcbounds = boundbox;
- ptk_closestruct();
- ptk_unstackbbox();
- ptk_unstacktsl();
-
- if (wcbounds->x_min == 1000.0)
- {
- *wcbounds = ptk_limit3(0.0, 1.0, 0.0, 1.0, 0.0, 1.0);
- return FALSE;
- }
- else
- return TRUE;
- } /* ptk_boundingbox */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inittsl(C(void))
- /* PreANSI() */
- /*
- ** \blurb{This function initialises the current TSL values to the
- ** default values from the PHIGS description table.
- ** The default ASF value for each attribute is assumed to be INDIVIDUAL.}
- */
- {
- /* polyline */
- tsl.lnattr.ind = 1;
- tsl.lnattr.bundle.type = 1;
- tsl.lnattr.bundle.width = 1.0;
- tsl.lnattr.bundle.colr_ind = 1;
- tsl.lnattr.type_asf = PASF_INDIV;
- tsl.lnattr.width_asf = PASF_INDIV;
- tsl.lnattr.colr_ind_asf = PASF_INDIV;
- /* marker */
- tsl.mkattr.ind = 1;
- tsl.mkattr.bundle.type = 3;
- tsl.mkattr.bundle.size = 1.0;
- tsl.mkattr.bundle.colr_ind = 1;
- tsl.mkattr.type_asf = PASF_INDIV;
- tsl.mkattr.size_asf = PASF_INDIV;
- tsl.mkattr.colr_ind_asf = PASF_INDIV;
- /* interior */
- tsl.interattr.ind = 1;
- tsl.interattr.bundle.style = PSTYLE_HOLLOW;
- tsl.interattr.bundle.style_ind = 1;
- tsl.interattr.bundle.colr_ind = 1;
- tsl.interattr.style_asf = PASF_INDIV;
- tsl.interattr.style_ind_asf = PASF_INDIV;
- tsl.interattr.colr_ind_asf = PASF_INDIV;
- /* edge */
- tsl.edgeattr.ind = 1;
- tsl.edgeattr.bundle.flag = PEDGE_OFF;
- tsl.edgeattr.bundle.type = 1;
- tsl.edgeattr.bundle.width = 1.0;
- tsl.edgeattr.bundle.colr_ind = 1;
- tsl.edgeattr.flag_asf = PASF_INDIV;
- tsl.edgeattr.width_asf = PASF_INDIV;
- tsl.edgeattr.colr_ind_asf = PASF_INDIV;
- tsl.edgeattr.type_asf = PASF_INDIV;
- /* text */
- tsl.txbundl.font = 1;
- tsl.txbundl.prec = PPREC_STRING;
- tsl.txbundl.char_expan = 1.0;
- tsl.txbundl.char_space = 0.0;
- tsl.txbundl.colr_ind = 1;
- tsl.textindex = 1;
- tsl.textfontasf = PASF_INDIV;
- tsl.textprecasf = PASF_INDIV;
- tsl.charexpanasf = PASF_INDIV;
- tsl.charspaceasf = PASF_INDIV;
- tsl.textcolourasf = PASF_INDIV;
- tsl.charheight = 0.01;
- tsl.charup= ptk_point(0.0, 1.0);
- tsl.textpath = PPATH_RIGHT;
- tsl.textalign.hor = PHOR_NORM;
- tsl.textalign.vert = PVERT_NORM;
- tsl.annocharheight = 0.01;
- tsl.annocharup = ptk_point(0.0, 1.0);
- tsl.annotextpath = PPATH_RIGHT;
- tsl.annotextalign.hor = PHOR_NORM;
- tsl.annotextalign.vert = PVERT_NORM;
- tsl.annostyle = 1;
- /* pattern */
- tsl.patsize.size_x = 1.0;
- tsl.patsize.size_y = 1.0;
- tsl.patrefpt = ptk_point3(0.0, 0.0, 0.0);
- tsl.patvec[0] = ptk_point3(1.0, 0.0, 0.0);
- tsl.patvec[1] = ptk_point3(0.0, 1.0, 0.0);
- /* pick identifier */
- tsl.pickid = 0;
- /* view index */
- tsl.viewindex = 0;
- /* HLHSR identifier */
- tsl.hlhsrid = 0;
- /* name set */
- tsl.nameset.num_ints = 0;
- tsl.nameset.ints = tsl.names;
- /* global modelling transformation */
- ptk_unitmatrix3(tsl.globaltran);
- /* local modelling transformation */
- ptk_unitmatrix3(tsl.localtran);
- /* modelling clip */
- /* Implementation dependent - HP doesn't support
- ** modelling clip.
- */
- #ifdef SUN
- tsl.modelclipoperator = PMC_REPLACE;
- #endif
- #ifdef PEXSI
- tsl.modelclipoperator = PMC_REPLACE;
- #endif
- #ifdef HP
- tsl.modelclipoperator = 0;
- #endif
- tsl.modelclipvolume.num_half_spaces = 0;
- tsl.modelclipindicator = PIND_NO_CLIP;
- boundbox = ptk_limit3(1000.0, -1000.0, 1000.0, -1000.0, 1000.0, -1000.0);
- #ifdef SUN
- tsl.tslplus.datamapindex = 1;
- tsl.tslplus.backintindex = 1;
- tsl.tslplus.backdatamapindex = 1;
- tsl.tslplus.reflindex = 1;
- tsl.tslplus.backreflindex = 1;
- tsl.tslplus.paramsurfindex = 1;
- tsl.tslplus.linecolour.type = PINDIRECT;
- tsl.tslplus.linecolour.val.ind = 1;
- tsl.tslplus.lineshadmeth = 1;
- tsl.tslplus.linecolourasf = PASF_INDIV;
- tsl.tslplus.lineshadmethasf = PASF_INDIV;
- tsl.tslplus.markercolour.type = PINDIRECT;
- tsl.tslplus.markercolour.val.ind = 1;
- tsl.tslplus.markercolourasf = PASF_INDIV;
- tsl.tslplus.textcolour.type = PINDIRECT;
- tsl.tslplus.textcolour.val.ind = 1;
- tsl.tslplus.textcolourasf = PASF_INDIV;
- tsl.tslplus.distingmode = PDISTING_NO;
- tsl.tslplus.cullmode = PCULL_NONE;
- tsl.tslplus.intcolour.type = PINDIRECT;
- tsl.tslplus.intcolour.val.ind = 1;
- tsl.tslplus.intshadmeth = 1;
- tsl.tslplus.datamapmeth = 1;
- tsl.tslplus.reflprops.ambient_coef = 1.0;
- tsl.tslplus.reflprops.diffuse_coef = 1.0;
- tsl.tslplus.reflprops.specular_coef = 1.0;
- tsl.tslplus.reflprops.specular_colr.type = 1;
- tsl.tslplus.reflprops.specular_colr.val.general.x = 1.0;
- tsl.tslplus.reflprops.specular_colr.val.general.y = 1.0;
- tsl.tslplus.reflprops.specular_colr.val.general.z = 1.0;
- tsl.tslplus.reflprops.specular_exp = 0.0;
- tsl.tslplus.reflprops.transpar_coef = 1.0;
- tsl.tslplus.reflmodel = 1;
- tsl.tslplus.intcolourasf = PASF_INDIV;
- tsl.tslplus.intshadmethasf = PASF_INDIV;
- tsl.tslplus.datamapmethasf = PASF_INDIV;
- tsl.tslplus.reflpropsasf = PASF_INDIV;
- tsl.tslplus.reflmodelasf = PASF_INDIV;
- tsl.tslplus.backintstyle = PSTYLE_HOLLOW;
- tsl.tslplus.backintcolour.type = PINDIRECT;
- tsl.tslplus.backintcolour.val.ind = 1;
- tsl.tslplus.backintshadmeth = 1;
- tsl.tslplus.backdatamapmeth = 1;
- tsl.tslplus.backreflprops.ambient_coef = 1.0;
- tsl.tslplus.backreflprops.diffuse_coef = 1.0;
- tsl.tslplus.backreflprops.specular_coef = 1.0;
- tsl.tslplus.backreflprops.specular_colr.type = 1;
- tsl.tslplus.backreflprops.specular_colr.val.general.x = 1.0;
- tsl.tslplus.backreflprops.specular_colr.val.general.y = 1.0;
- tsl.tslplus.backreflprops.specular_colr.val.general.z = 1.0;
- tsl.tslplus.backreflprops.specular_exp = 0.0;
- tsl.tslplus.backreflprops.transpar_coef = 1.0;
- tsl.tslplus.backreflmodel = 1;
- tsl.tslplus.backintstyleasf = PASF_INDIV;
- tsl.tslplus.backintstyleindexasf = PASF_INDIV;
- tsl.tslplus.backintcolourasf = PASF_INDIV;
- tsl.tslplus.backintshadmethasf = PASF_INDIV;
- tsl.tslplus.backdatamapmethasf = PASF_INDIV;
- tsl.tslplus.backreflpropsasf = PASF_INDIV;
- tsl.tslplus.backreflmodelasf = PASF_INDIV;
- tsl.tslplus.lightsrcstate.num_ints = 0;
- tsl.tslplus.lightsrcstate.ints = tsl.tslplus.lights;
- tsl.tslplus.edgecolour.type = PINDIRECT;
- tsl.tslplus.edgecolour.val.ind = 1;
- tsl.tslplus.edgecolourasf = PASF_INDIV;
- tsl.tslplus.curveapproxtype = 1;
- tsl.tslplus.curveapproxval = 1.0;
- tsl.tslplus.curveapproxasf = PASF_INDIV;
- tsl.tslplus.surfapproxtype = 1;
- tsl.tslplus.surfapproxuval = 1.0;
- tsl.tslplus.surfapproxvval = 1.0;
- tsl.tslplus.surfapproxval = PASF_INDIV;
- tsl.tslplus.parasurftype = 1;
- tsl.tslplus.parasurfasf = PASF_INDIV;
- tsl.tslplus.renderingmodel = 0;
- tsl.tslplus.dcueindex = 1;
- tsl.tslplus.colourmapindex = 1;
- #endif
- } /* ptk_inittsl */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_initbbox(C(void))
- /* PreANSI() */
- /*
- ** \blurb{This function initialises the current TSL bounding box value
- ** to be (1000.0, -1000.0, 1000.0, -1000.0, 1000.0, -1000.0). This enables
- ** the real bounding box to be set when an output primitive is reached.}
- */
- {
- boundbox = ptk_limit3(1000.0, -1000.0, 1000.0, -1000.0, 1000.0, -1000.0);
- } /* ptk_initbbox */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_tsltraversepath(C(Pelem_ref_list *) reflst)
- PreANSI(Pelem_ref_list *reflst)
- /*
- ** \parambegin
- ** \param{Pelem\_ref\_list *}{reflst}{structure-element path}{IN}
- ** \paramend
- ** \blurb{This function makes TSL traverse a structure path
- ** and updates the current TSL values appropriately.}
- */
- {
- Pint stid, sno;
- Plimit3 bbox;
-
- ptk_stacktsl();
- stid = reflst->elem_refs[0].struct_id;
- ptk_openstruct(stid);
- sno = 1;
- tsltraversepath(&sno, stid, reflst);
- ptk_closestruct();
- } /* ptk_tsltraversepath */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_tsltraverserange(C(Pint) startstid, C(Pint) startelemid,
- C(Pint) stopstid, C(Pint) stopelemid, C(ptkboolean) descend)
- PreANSI(Pint startstid)
- PreANSI(Pint startelemid)
- PreANSI(Pint stopstid)
- PreANSI(Pint stopelemid)
- PreANSI(ptkboolean descend)
- /*
- ** \parambegin
- ** \param{Pint}{startstid}{start structure identifier}{IN}
- ** \param{Pint}{startelemid}{start element number}{IN}
- ** \param{Pint}{stopstid}{stop structure identifier}{IN}
- ** \param{Pint}{stopelemid}{stop element number}{IN}
- ** \param{ptkboolean}{descend}{flag to indicate traversal}{IN}
- ** \paramend
- ** \blurb{This function makes TSL traverse between two points in a structure
- ** network. If {\tt descend} is set to TRUE then any
- ** EXECUTE STRUCTURE elements which occur between the two points
- ** are followed, otherwise they are ignored.}
- */
- {
- ptk_openstruct(startstid);
- tsltraverserange(startstid, startelemid, stopstid, stopelemid, descend);
- ptk_closestruct();
- } /* ptk_tsltraverserange */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_settslstart(C(Pint) startstid, C(Pint) startelemid)
- PreANSI(Pint startstid)
- PreANSI(Pint startelemid)
- /*
- ** \parambegin
- ** \param{Pint}{startstid}{start structure identifier}{IN}
- ** \param{Pint}{startelemid}{start element number}{IN}
- ** \paramend
- ** \blurb{This function sets the TSL traversal to start at a certain point
- ** in a structure network. This structure is referred to as the TSL structure
- ** network.}
- */
- {
- ptk_inittsl();
- curstid = firststid = startstid;
- curelemid = firstelemid = startelemid;
- } /* ptk_settslstart */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_tsltraversenext(C(void))
- /* PreANSI() */
- /*
- ** \blurb{This function makes TSL traverse the next element in the current
- ** TSL structure network. If it is an EXECUTE STRUCTURE element
- ** TSL will follow the execute path.}
- */
- {
- Pint i, numelts, execid, err;
-
- numelts = ptk_elemcount(curstid);
- if (curelemid > numelts)
- {
- if (curstid == firststid)
- {
- ptk_inittsl();
- curelemid = firstelemid;
- }
- else
- {
- do
- {
- ptk_unstacktsl();
- unstackpos();
- } while ((curelemid > ptk_elemcount(curstid)) && (tslpos != NULL));
- }
- }
- ptk_openstruct(curstid);
- pset_elem_ptr(curelemid);
- curelemid++;
- if (tsltraverseelement(&execid, &boundbox))
- {
- ptk_stacktsl();
- stackpos();
- curstid = execid;
- curelemid = 1;
- ptk_multiplymatrix3(tsl.globaltran, tsl.localtran, tsl.globaltran);
- ptk_unitmatrix3(tsl.localtran);
- }
- ptk_closestruct();
- } /* ptk_tsltraversenext */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_tsltraversetoend(C(void))
- /* PreANSI() */
- /*
- ** \blurb{This function makes TSL traverse to the end of the TSL structure
- ** network.}
- */
- {
- while ((curstid != firststid) && (curelemid != firstelemid))
- ptk_tsltraversenext();
- } /* ptk_tsltraversetoend */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqboundingbox(C(Plimit3 *) bbox)
- PreANSI(Plimit3 *bbox)
- /*
- ** \parambegin
- ** \param{Plimit3 *}{bbox}{bounding box (WC)}{OUT}
- ** \paramend
- ** \blurb{This function may be used to obtain current TSL bounding box
- ** value. This is the bounding box of the TSL structure network at the
- ** current point of traversal.}
- */
- {
- *bbox = boundbox;
- } /* ptk_inqboundingbox */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqtsledge(C(Pint *) edgeind, C(Pedge_flag *) edgeflag,
- C(Pint *) edgetype, C(Pfloat *) edgewidth, C(Pint *) edgecolour)
- PreANSI(Pint *edgeind)
- PreANSI(Pedge_flag *edgeflag)
- PreANSI(Pint *edgetype)
- PreANSI(Pfloat *edgewidth)
- PreANSI(Pint *edgecolour)
- /*
- ** \parambegin
- ** \param{Pint *}{edgeind}{edge index}{OUT}
- ** \param{Pedge\_flag *}{edgeflag}{edge flag}{OUT}
- ** \param{Pint *}{edgetype}{edge type}{OUT}
- ** \param{Pfloat *}{edgewidth}{edge width}{OUT}
- ** \param{Pint *}{edgecolour}{edge colour}{OUT}
- ** \paramend
- ** \blurb{This function may be used to obtain the current TSL
- ** edge attributes.}
- */
- {
- *edgeind = tsl.edgeattr.ind;
- *edgeflag = tsl.edgeattr.bundle.flag;
- *edgetype = tsl.edgeattr.bundle.type;
- *edgewidth = tsl.edgeattr.bundle.width;
- *edgecolour = tsl.edgeattr.bundle.colr_ind;
- } /* ptk_inqtsledge */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqtslline(C(Pint *) lineind, C(Pint *) linetype,
- C(Pfloat *) linewidth, C(Pint *) linecolour)
- PreANSI(Pint *lineind)
- PreANSI(Pint *linetype)
- PreANSI(Pfloat *linewidth)
- PreANSI(Pint *linecolour)
- /*
- ** \parambegin
- ** \param{Pint *}{lineind}{line index}{OUT}
- ** \param{Pint *}{linetype}{line type}{OUT}
- ** \param{Pfloat *}{linewidth}{line width}{OUT}
- ** \param{Pint *}{linecolour}{line colour}{OUT}
- ** \paramend
- ** \blurb{This function may be used to obtain the current TSL line
- ** attributes.}
- */
- {
- *lineind = tsl.lnattr.ind;
- *linetype = tsl.lnattr.bundle.type;
- *linewidth = tsl.lnattr.bundle.width;
- *linecolour = tsl.lnattr.bundle.colr_ind;
- } /* ptk_inqtslline */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqtslmarker(C(Pint *) markerind, C(Pint *) markertype,
- C(Pfloat *) markersize, C(Pint *) markercolour)
- PreANSI(Pint *markerind)
- PreANSI(Pint *markertype)
- PreANSI(Pfloat *markersize)
- PreANSI(Pint *markercolour)
- /*
- ** \parambegin
- ** \param{Pint *}{markerind}{marker index}{OUT}
- ** \param{Pint *}{markertype}{marker type}{OUT}
- ** \param{Pfloat *}{markersize}{marker size}{OUT}
- ** \param{Pint *}{markercolour}{marker colour}{OUT}
- ** \paramend
- ** \blurb{This function may be used to obtain the current TSL marker
- ** attributes.}
- */
- {
- *markerind = tsl.mkattr.ind;
- *markertype = tsl.mkattr.bundle.type;
- *markersize = tsl.mkattr.bundle.size;
- *markercolour = tsl.mkattr.bundle.colr_ind;
- } /* ptk_inqtslmarker */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqtslinterior(C(Pint *) intind, C(Pint *) intstyle,
- C(Pint *) intstyleind, C(Pint *) intcolour)
- PreANSI(Pint *intind)
- PreANSI(Pint *intstyle)
- PreANSI(Pint *intstyleind)
- PreANSI(Pint *intcolour)
- /*
- ** \parambegin
- ** \param{Pint *}{intind}{interior index}{OUT}
- ** \param{Pint *}{intstyle}{interior style}{OUT}
- ** \param{Pfloat *}{intstyleind}{interior style index}{OUT}
- ** \param{Pint *}{intcolour}{interior colour}{OUT}
- ** \paramend
- ** \blurb{This function may be used to obtain the current TSL interior
- ** attributes.}
- */
- {
- *intind = tsl.interattr.ind;
- *intstyle = tsl.interattr.bundle.style;
- *intstyleind = tsl.interattr.bundle.style_ind;
- *intcolour = tsl.interattr.bundle.colr_ind;
- } /* ptk_inqtslint */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqtsltext(C(Pint *) textind, C(Pint *) textfont,
- C(Ptext_prec *) textprec, C(Ptext_path *) textpath,
- C(Ptext_align *) textalign, C(Pint *) textcolour)
- PreANSI(Pint *textind)
- PreANSI(Pint *textfont)
- PreANSI(Ptext_prec *textprec)
- PreANSI(Ptext_path *textpath)
- PreANSI(Ptext_align *textalign)
- PreANSI(Pint *textcolour)
- /*
- ** \parambegin
- ** \param{Pint *}{textind}{text index}{OUT}
- ** \param{Pint *}{textfont}{text font}{OUT}
- ** \param{Ptext\_prec *}{textprec}{text precision}{OUT}
- ** \param{Ptext\_path *}{textpath}{text path}{OUT}
- ** \param{Ptext\_align *}{textalign}{text alignment}{OUT}
- ** \param{Pint *}{textcolour}{text colour}{OUT}
- ** \paramend
- ** \blurb{This function may be used to obtain the current TSL text
- ** attributes.}
- */
- {
- *textind = tsl.textindex;
- *textfont = tsl.txbundl.font;
- *textprec = tsl.txbundl.prec;
- *textpath = tsl.textpath;
- *textalign = tsl.textalign;
- *textcolour = tsl.txbundl.colr_ind;
- } /* ptk_inqtsltext */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqtslannotext(C(Pint *) style, C(Pfloat *) charheight,
- C(Ppoint *) charup, C(Ptext_align *) textalign,
- C(Ptext_path *) textpath)
- PreANSI(Pint *style)
- PreANSI(Pfloat *charheight)
- PreANSI(Ppoint *charup)
- PreANSI(Ptext_path *textpath)
- PreANSI(Ptext_align *textalign)
- /*
- ** \parambegin
- ** \param{Pint *}{style}{annotation style}{OUT}
- ** \param{Pfloat *}{charheight}{annotation character height}{OUT}
- ** \param{Ppoint *}{charup}{annotation character up vector}{OUT}
- ** \param{Ptext\_align *}{textalign}{annotation text alignment}{OUT}
- ** \param{Ptext\_path *}{textpath}{annotation text path}{OUT}
- ** \paramend
- ** \blurb{This function may be used to obtain the current TSL
- ** annotation text attributes.}
- */
- {
- *style = tsl.annostyle;
- *charheight = tsl.annocharheight;
- *charup = tsl.annocharup;
- *textalign = tsl.annotextalign;
- *textpath = tsl.annotextpath;
- } /* ptk_inqtslannotext */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqtslchar(C(Pfloat *) exp, C(Pfloat *) spacing,
- C(Pfloat *) height, C(Ppoint *) charup)
- PreANSI(Pfloat *exp)
- PreANSI(Pfloat *spacing)
- PreANSI(Pfloat *height)
- PreANSI(Ppoint *charup)
- /*
- ** \parambegin
- ** \param{Pfloat *}{exp}{character expansion factor}{OUT}
- ** \param{Pfloat *}{spacing}{character spacing}{OUT}
- ** \param{Pfloat *}{height}{character height}{OUT}
- ** \param{Ppoint *}{charup}{character up vector}{OUT}
- ** \paramend
- ** \blurb{This function may be used to obtain the current TSL character
- ** attributes.}
- */
- {
- *exp = tsl.txbundl.char_expan;
- *spacing = tsl.txbundl.char_space;
- *height = tsl.charheight;
- *charup = tsl.charup;
- } /* ptk_inqtslannotext */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqtslctm(C(Pmatrix3) globaltran, C(Pmatrix3) localtran)
- PreANSI(Pmatrix3 globaltran)
- PreANSI(Pmatrix3 localtran)
- /*
- ** \parambegin
- ** \param{Pmatrix3}{globaltran}{global transformation matrix}{OUT}
- ** \param{Pmatrix3}{localtran}{local transformation matrix}{OUT}
- ** \paramend
- ** \blurb{This function may be used to obtain the current TSL transformation
- ** matrices.}
- */
- {
- memcpy(globaltran, tsl.globaltran, sizeof(Pmatrix3));
- memcpy(localtran, tsl.localtran, sizeof(Pmatrix3));
- } /* ptk_inqtslctm */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqtslnameset(C(Pint) size, C(Pint_list *) nameset,
- C(Pint *) totalsize)
- PreANSI(Pint size)
- PreANSI(Pint_list *nameset)
- PreANSI(Pint *totalsize)
- /*
- ** \parambegin
- ** \param{Pint}{size}{length of nameset integer list}{IN}
- ** \param{Pint\_list *}{nameset}{current nameset}{OUT}
- ** \param{Pint *}{totalsize}{actual length of nameset integer list}{OUT}
- ** \paramend
- ** \blurb{This function may be used to obtain the current TSL nameset.}
- */
- {
- Pint i;
-
- if (size >= tsl.nameset.num_ints)
- for (i = 0; i < tsl.nameset.num_ints; i++)
- nameset->ints[i] = tsl.nameset.ints[i];
- *totalsize = tsl.nameset.num_ints;
- } /* ptk_inqtslnameset */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqtslids(C(Pint *) pickid, C(Pint *) hlhsrid,
- C(Pint *) viewind)
- PreANSI(Pint *pickid)
- PreANSI(Pint *hlhsrid)
- PreANSI(Pint *viewind)
- /*
- ** \parambegin
- ** \param{Pint *}{pickid}{pick identifier}{OUT}
- ** \param{Pint *}{hlhsrid}{HLHSR identifier}{OUT}
- ** \param{Pint *}{viewind}{view index}{OUT}
- ** \paramend
- ** \blurb{This function may be used to obtain the current TSL values
- ** for pick identifier, HLHSR identifier and view index.}
- */
- {
- *pickid = tsl.pickid;
- *hlhsrid = tsl.hlhsrid;
- *viewind = tsl.viewindex;
- } /* ptk_inqtslids */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqtslpattern(C(Pfloat_size *) size, C(Ppoint3 *) refpt,
- C(Ppoint3 *) refvec)
- PreANSI(Pfloat_size *size)
- PreANSI(Ppoint3 *refpt)
- PreANSI(Ppoint3 refvec[2])
- /*
- ** \parambegin
- ** \param{Pfloat\_size *}{size}{pattern size}{OUT}
- ** \param{Ppoint3 *}{refpt}{pattern reference point}{OUT}
- ** \param{Ppoint3 *}{refvec}{pattern reference vectors}{OUT}
- ** \paramend
- ** \blurb{This function may be used to obtain the current TSL pattern
- ** attributes.}
- */
- {
- *size = tsl.patsize;
- *refpt = tsl.patrefpt;
- refvec[0] = tsl.patvec[0];
- refvec[1] = tsl.patvec[1];
- } /* ptk_inqtslpattern */
-
- /*--------------------------------------------------------------------------*/
-
- /*function:external*/
- extern void ptk_inqtslattrasf(C(Paspect) attr, C(Pasf *) asf)
- PreANSI(Paspect attr)
- PreANSI(Pasf *asf)
- /*
- ** \parambegin
- ** \param{Paspect}{attr}{attribute type}{IN}
- ** \param{Pasf *}{asf}{attribute aspect source flag}{OUT}
- ** \paramend
- ** \blurb{This function may be used to obtain the current TSL
- ** aspect source flag value for attribute type {\tt attr}.}
- */
- {
- switch (attr)
- {
- case PASPECT_LINETYPE: *asf = tsl.lnattr.type_asf;
- break;
-
- case PASPECT_LINEWIDTH: *asf = tsl.lnattr.width_asf;
- break;
-
- case PASPECT_LINE_COLR_IND: *asf = tsl.lnattr.colr_ind_asf;
- break;
-
- case PASPECT_MARKER_TYPE: *asf = tsl.mkattr.type_asf;
- break;
-
- case PASPECT_MARKER_SIZE:
- *asf = tsl.mkattr.size_asf;
- break;
-
- case PASPECT_MARKER_COLR_IND: *asf = tsl.mkattr.colr_ind_asf;
- break;
-
- case PASPECT_TEXT_FONT: *asf = tsl.textfontasf;
- break;
-
- case PASPECT_TEXT_PREC: *asf = tsl.textprecasf;
- break;
-
- case PASPECT_CHAR_EXPAN: *asf = tsl.charexpanasf;
- break;
-
- case PASPECT_CHAR_SPACE: *asf = tsl.charspaceasf;
- break;
-
- case PASPECT_TEXT_COLR_IND: *asf = tsl.textcolourasf;
- break;
-
- case PASPECT_INT_STYLE: *asf = tsl.interattr.style_asf;
- break;
-
- case PASPECT_INT_STYLE_IND: *asf = tsl.interattr.style_ind_asf;
- break;
-
- case PASPECT_INT_COLR_IND: *asf = tsl.interattr.colr_ind_asf;
- break;
-
- case PASPECT_EDGE_FLAG: *asf = tsl.edgeattr.flag_asf;
- break;
-
- case PASPECT_EDGETYPE: *asf = tsl.edgeattr.type_asf;
- break;
-
- case PASPECT_EDGEWIDTH: *asf = tsl.edgeattr.width_asf;
- break;
-
- case PASPECT_EDGE_COLR_IND: *asf = tsl.edgeattr.colr_ind_asf;
- break;
- }
- } /* ptk_inqtslattrasf */
-
- /*--------------------------------------------------------------------------*/
-
- /* end of tsl.c */
-